home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / w00w00 / sectools / fragrouter / Libnet-0.99b / ensure-dir.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1999-07-26  |  522 b   |  26 lines

  1. #!/bin/sh
  2. #
  3. #   libnet support file
  4. #   Ensures a target directory will exist for the installer.
  5. #   Unknown author.
  6. #
  7.  
  8. pathname=$1
  9. mode=$2
  10. OLDIFS="${IFS}"; IFS=/; set $pathname; IFS="${OLDIFS}"
  11.  
  12. case $pathname in
  13.        /*)     partial=/; ;;
  14.        *)      partial=""; ;;
  15. esac
  16.  
  17. for i do
  18.        case i in "") continue; ;; esac
  19.        partial="${partial}${i}"
  20.        if [ ! -d ${partial} ]; then
  21.                mkdir ${partial} || exit 1;
  22.                chmod ${mode} ${partial}
  23.        fi
  24.        partial="${partial}/"
  25. done
  26.